<script lang="ts" setup name="TestB">
import mitt from '@/utils/mitt';
import { ref } from 'vue'

const msg = defineModel();
const num = defineModel('num');
// const num = defineModel('num', { required: true });

const mittVal = ref('');
mitt.on('updateTitle', (val:any) => {
  console.log('updateTitle', val);
  mittVal.value = val;
});
</script>

<template>
  <div class="testb">
    <p>TestB组件</p>
    <input v-model="msg" ref="el" />
    <input type="number" v-model="num" />
    <div>{{ 'mitt接收到的值' + mittVal }}</div>
  </div>
</template>
<style scoped>
.testb {
  border: 1px solid #dedede;
  padding: 10px;
  line-height: 24px;
}
</style>
